#!/bin/bash

if [ $# -lt 1 ]; then
   echo "$0 <dest_dir>"
   exit 1
fi

DEST=$1

while read f
do
  D=$(dirname "$f")
  B=$(basename "$D")
  DD=$(dirname "$D")
  DD=$(basename "$DD")
  DIR="$DEST/${DD}/${B}"
  mkdir -p "$DIR"
  cp -v "$f" "$DIR"
done < rom-valid.list
exit 0
